﻿using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Web;

namespace YlisChat.Models
{
    public enum AdminLevel
    {
        USER,
        VOICE,
        ADMIN
    }

    public enum AttachmentType
    {
        PICTURE,
        VOICE,
        VIDEO,
        UNKNOWN
    }

    #region DarabaseModels

    public class ChannelModel
    {
        [Key]
        [Required]
        [MaxLength(450)]
        public string HashTag { get; set; }

        public string Topic { get; set; }

        [Required]
        public bool Private { get; set; }
    }

    public class UserList
    {
        [Key]
        [Required]
        [JsonIgnore]
        public long Id { get; set; }

        [Required]
        public string UserId { get; set; }

        [Required]
        public string HashTag { get; set; }

        [Required]
        public AdminLevel AdminState { get; set; }
    }

    public class BanList
    {
        [Key]
        [Required]
        [JsonIgnore]
        public long Id { get; set; }

        [Required]
        public string UserId { get; set; }

        [Required]
        public string HashTag { get; set; }

        [DataType(DataType.DateTime)]
        public DateTime Expire { get; set; }

        public string Reason { get; set; }
    }

    public class Discussion
    {
        [Key]
        [Required]
        [MaxLength(450)]
        public string Id { get; set; }

        [Index]
        [Required]
        [MaxLength(450)]
        public string UserId { get; set; }

        [Index]
        [Required]
        [MaxLength(450)]
        public string HashTag { get; set; }

        [Required]
        public string Message { get; set; }

        public string AttachmentId { get; set; }

        [Required]
        [DataType(DataType.DateTime)]
        public DateTime TimeStamp { get; set; }

        public bool SystemMessage { get; set; }
    }

    public class Attachments
    {
        [Key]
        [Required]
        [MaxLength(450)]
        public string Id { get; set; }

        [Required]
        public AttachmentType Type { get; set; }

        [Required]
        public string OriginalName { get; set; }

        [Required]
        public string InternalName { get; set; }
    }

    #endregion DarabaseModels

    public class UserListViewModel
    {
        public string Nick { get; set; }
        public string Id { get; set; }
        public string HashTag { get; set; }
        public AdminLevel AdminState { get; set; }
    }

    public class ChannelCache
    {
        public string HashTag { get; set; }
        public List<string> UserIds { get; set; }
    }
}